package com.cy;

import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;


import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Scope("singleton")
@Lazy
@Component
public class ObjectPool{//假设此对象为一个对象池
    public ObjectPool(){
        System.out.println("ObjectPool()");
    }
    @PostConstruct
    public void init(){
        System.out.println("init()");
    }
    @PreDestroy
    public void destory(){
        System.out.println("destory()");
    }
}